﻿@model ConfigViewer

<div class="configuration section">
    <h2>Configuration</h2>
    
    @using (Html.BeginForm())
    {
        @Html.ValidationSummary(true, "Validation Errors")  

        <div id="tabs">
            <ul>
                @foreach(string pluginGroup in Model.ConfigGroups){ 
                    <li><a href="#@pluginGroup.Replace(" ", "") ">@pluginGroup </a></li>
                } 
            </ul>

            @foreach(string group in Model.ConfigGroups)
            { 
                <div id="@group.Replace(" ", "")">
                    <fieldset>
                        <legend>@group</legend>
                        <dl class="details">
                            @foreach(var config in Model.Configs.Where(item => item .Group.Equals(group, StringComparison.InvariantCultureIgnoreCase)))
                            { 
                                <dt>@config.Name </dt>
                                <dd>
                                    @if (config.Name == mesoBoard.Services.SiteConfig.BoardTheme.Name)
                                    {
                                        @Html.DropDownList(mesoBoard.Services.SiteConfig.BoardTheme.Name, Model.ThemeList)
                                    }
                                    else if (config.Name == mesoBoard.Services.SiteConfig.RegistrationRole.Name)
                                    {
                                        @Html.DropDownList(mesoBoard.Services.SiteConfig.RegistrationRole.Name, Model.RolesList)
                                    }
                                    else
                                    {
                                        @Html.Partial("_Config", config)       
                                    }
                                    <label class="note">@config.Note</label>
                                </dd>
                            } 
                        </dl>
                    </fieldset>
                </div>
            }
            <p style="text-align: center;padding: 5px;">
                <input type="submit" value="Save Changes on all Tabs" />
            </p> 
        </div> 
    }
</div>
